﻿<template>
    <div id="app">

        <mt-header v-bind:title="title" style="background-color:#fda10e">
            <a slot="left" @click="back()">返回</a>

        </mt-header>
        <div class="mui-content">
            <ul class="mui-table-view">
                <li class="mui-table-view-cell" style="text-align:center">
                    <img  v-if="info.imgurl!=''"  :src="info.imgurl" width="70%"/>
                    <img  v-else src="../assets/images/headimg.png" width="70%"/>
                </li>
                <li class="mui-table-view-cell">学号 <span class="" style="float:right;">{{info.number}}</span></li>
                <li class="mui-table-view-cell">学生姓名 <span class="" style="float:right;">{{info.truename}}</span></li>
                <li class="mui-table-view-cell">班级 <span class="" style="float:right;">{{info.classname}}</span></li>
                <li class="mui-table-view-cell">班主任姓名 <span class="" style="float:right;">{{info.teachername}}</span></li>
                <li class="mui-table-view-cell">班主任联系电话 <span class="" style="float:right;"><a  :href="'tel:'+info.teacherphone">{{info.teacherphone}}</a></span></li>



            </ul>

        </div>

    </div>

</template>

<script>
    import { Toast } from 'mint-ui';
    import Bus from '../bus.js'
    export default {
        name: 'app',
        data() {
            return {
                title: "我的资料",

                info: {},

            }
        },
        mounted() {
            window.history.pushState('forward', null, '#');
            window.history.forward(1);

            window.onpopstate = () => {
                Bus.$emit('val', "show");
                this.$router.go(-1);

            }
        },
        methods:
        {
            loadMore() {
                this.$data.busy = true  //将无限滚动给禁用
                setTimeout(() => {  //发送请求有时间间隔第一个滚动时间结束后才发送第二个请求
                    this.$data.page = this.$data.page + 1;
                    this.load();
                }, 500);
            },
            load: function () {
                var studentid = window.localStorage.getItem("studentid");


                var _this = this;
                this.$api.post('wx/Index/getstudent', {
                    "studentid": studentid
                }, response => {
                    if (response.status >= 200 && response.status < 300) {
                        console.log(response.data);
                        var data = response.data;
                        if (data.status == 200) {

                            _this.$data.info = data.data;
                        }



                    }
                
                
                 else {
                    console.log(response.message);
                    //请求失败，response为失败信息
                }
        });

    },

    back: function () {
        Bus.$emit('val', "show")
        this.$router.go(-1);
    }
        },
    components: {

    },
    created: function () {
        this.load();

    }
    }
</script>

<style scoped>
    .loading {
        width: 100%;
        margin-bottom: 2px;
        text-align: center;
    }
</style>